<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="/commons/taglibs.jsp"%>
<%@ include file="/commons/commonEdit.jsp"%>
<%@ include file="/commons/dateTime.jsp" %>
<%@ include file="/commons/validation.jsp" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>入伙资料收发</title>
<script language="JavaScript" src="${ctx}/scripts/common/prototype.js"></script>
<script language="JavaScript" type="text/javascript" src="${ctx}/scripts/ajaxException.js"></script>
<script type="text/javascript" src="${ctx}/scripts/common.js"></script>
<script type="text/javascript" src="${ctx}/scripts/div/common.js"></script>
<script>
var str ="";
function next(url){
	window.location.href = url;
}
function setCheckStatus(self,relation){
    var selfs = document.getElementsByName(self);
    var count = 0;
    for(var i =0 ; i<selfs.length;i++){
		if(selfs[i].checked)
			count++;
	}
	var isRelationCheck = null;
	if(count == selfs.length){
		isRelationCheck = true;
	}else if(count >= 0){
		isRelationCheck = false;
	}
	var relations = document.getElementsByName(relation);
	if(isRelationCheck != null){
		for(var i =0 ; i<relations.length;i++){
			relations[i].checked = isRelationCheck;
		}
	}
}
function getResult(name){
    var str="";
	var relations = document.getElementsByName(name);
	for(var i =0 ; i<relations.length;i++){
		if(relations[i].checked){
			str = str + relations[i].value+",";
		}
	}
	return str;
}
function addDocSend(){
	$('sendDocumentItemConfigStr').value=getResult('propertyType2');
	$('absentDocumentItemConfigStr').value=getResult('propertyType1');
	var isTrue=$('docSendForm').fireEvent("onSubmit") ;
    if(isTrue){
        var param = Form.serialize('docSendForm');
        var url = null;
		url = "${ctx}/occupation_joinHandleAction.do?method=editSendDoc&identityValidateId=${identityValidateId}";
        new Ajax.Request(url,{method: 'post',parameters :param ,onSuccess : showResult});
	}
}
function showResult(response){
    ajaxSubmitException(response.responseText);
    if(response.responseText != "true"){
    	Alert(response.responseText);
    }
	var obj=findFrame('identityMain');
	obj.reloadIdentity();
	windowClose();
}
function selectInit(strs,checkstr,name){
	var str = strs;
	var len = 0;
	var propertyType=document.getElementsByName(checkstr);
	for (var   i=0;   i<propertyType.length;   i++){
        if(str.indexOf(propertyType[i].value,0)>-1) {
         	propertyType[i].checked = true;
         	len++;
        }
     }

     if(len == propertyType.length){
     	$(name).checked = true;
     }
}
function init(){
	selectInit("${documentReceiveSend.sendDocumentItemConfigStr}","propertyType2","sendConfigCheck");
	selectInit("${documentReceiveSend.absentDocumentItemConfigStr}","propertyType1","absentCheck");
	if("${identityValidate.handoverState}" == "1")
	  $('doctable').disabled = true;
}
</script>
</head>

<body onload="init()">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td class="window_head_outBg"><table border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td><img src="${ctx}/images/ico_Advance.gif" width="16" height="16" align="absmiddle" /> <span class="window_head_intext">入伙资料收发</span></td>
        </tr>
    </table></td>
  </tr>
  <tr>
    <td class="aux_header_line_1"></td>
  </tr>
  <tr>
    <td class="aux_header_line_2"></td>
  </tr>
  <tr>
    <td valign="middle" class="content"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="container_in_show">
      <tr>
        <td valign="top">
            <div id="tab_Search"   style="height:410px;overflow:auto;">
              <table width="100%" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" id="tab_subMenu1">
                      <tr>
                        <td>

                            <table width="100%" border="0" align="center" cellpadding="5" cellspacing="0">
                            <tr>
                              <td valign="top">
                              <form action="" name="docSendForm" method="post" class="required-validate">
                              <input type="hidden" name="keyword" value="${documentReceiveSend.keyword }">
                              <input type="hidden" name="sendDocumentItemConfigStr" >
                              <input type="hidden" name="absentDocumentItemConfigStr" >
                              <table width="100%" border="0" cellpadding="0" cellspacing="1" class="aux_intable_color" id="table01" style="display:show">
						        <tr>
						          <td colspan="4" valign="top" class="aux_titletable">管理房号:${coalitionHouseNumber }&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						          <c:if test="${identityValidate.joinMode eq '002' }"><span style="font-weight:normal"> 按管理房办理</span> </c:if>
						          </td>
						        </tr>
						        <c:forEach items="${clientInfoSet}" var="client">
						        <tr>
						          <td valign="top" class="aux_intable_td1">相关房号：</td>
						          <td valign="top" class="aux_intable_td2">${client.realHouseNumber }</td>
						          <td valign="top" class="aux_intable_td1">业 主：</td>
						          <td class="aux_intable_td2">
						          		${client.realHouseClientInfo }<br>
						          </td>
						        </tr>
						        </c:forEach>
                                <tr>
                                  <td colspan="4" class="aux_titletable">缺失的资料</td>
                                </tr>
                                <tr>
                                  <td valign="top" class="aux_intable_td1">资料名称：</td>
                                  <td colspan="3" class="aux_intable_td2">
                                    <input type="checkbox" name="absentCheck" onclick="setCheckStatus('absentCheck','propertyType1')"/>全 选<br />
					                <logic:iterate id="absentConfig" name="absentDocConfig">
                                        <input type="checkbox" name="propertyType1" value="${absentConfig.keyword}" onclick="setCheckStatus('propertyType1','absentCheck')">
		                                <bean:write name="absentConfig" property="absentDocumentItemName"/>&nbsp;&nbsp;&nbsp;
					                </logic:iterate>
					                </td>
                                </tr>
                                <tr>
                                      <td colspan="4" class="aux_titletable">发放的资料</td>
                                </tr>
								<tr>
                                      <td valign="top" class="aux_intable_td1"> 资料名称：</td>
                                      <td colspan="3" class="aux_intable_td2">
									   <input type="checkbox" name="sendConfigCheck" onclick="setCheckStatus('sendConfigCheck','propertyType2')"/>全 选<br />
                                       <logic:iterate id="sendConfig" name="sendDocConfig">
                                           <input type="checkbox" name="propertyType2" value="${sendConfig.keyword}" onclick="setCheckStatus('propertyType2','sendConfigCheck')">
		                                   <bean:write name="sendConfig" property="sendDocumentItemName"/>&nbsp;&nbsp;&nbsp;
					                   </logic:iterate></td>
                                </tr>
                                <tr>
                                      <td class="aux_intable_td1">发放日期：</td>
                                      <td colspan="3" class="aux_intable_require"><table border="0" cellspacing="0" cellpadding="0">
                                        <tr>
                                          <td><input name="sendDocumengDate" id="sendDocumengDate" type="text"
                                            class="required validate-date-yyyy-MM-dd validate-ajax" replaceId="dataValue"
                   			  				validateUrl="${ctx}/common_sysrefcodeAction.do?method=compareCurrentDate&dateFormat=yyyy-MM-dd&compareType=smallEqualsCurrentDate" validateMessage="输入的发放日期必须小于等于当前系统时间"
                                            value="${documentReceiveSend.sendDocumengDate }" size="16" maxlength="10" afterInsert="dateAfter"/></td>
                                          <td width="4">&nbsp;</td>
                                          <td><img name="sendDocumengDateButton" src="${ctx}/images/ico_clock.gif" width="20" height="20" /><span id="dateAfter"></span></td>
                                        </tr>
                                      </table></td>
                                </tr>
								<tr>
                                    <td colspan="4" class="aux_titletable">缴 费</td>
                                </tr>
								<tr>
									<td class="aux_intable_td1">物业管理费预缴金额：</td>
                                    <td colspan="3" class="aux_intable_td2"><fmt:formatNumber pattern='###,##0.00' value='${total}'/> 元 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    	<c:if test="${chargeState eq '1' }">
                                    		已缴费
                                    	</c:if>
                                    </td>
							    </tr>
                                <tr>
                                      <td valign="top" class="aux_intable_td1">备 注：</td>
                                      <td colspan="3" class="aux_intable_td2"><textarea name=description cols="29" rows="3" class="max-length-200">${documentReceiveSend.description }</textarea></td>
                                </tr>
                               </table>
                               </form>
                              </td>
                            </tr>
                        </table></td>
                      </tr>
                  </table></td>
                </tr>
              </table>
            </div></td>
        </tr>
       </table></td>
  </tr>
<tr>
    <td class="window_footer"><table border="0" cellpadding="0" cellspacing="0">
        <tr>
		  <td class="btn_between_space"></td>
          <td>
          <table border="0" cellpadding="0" cellspacing="0" onclick="addDocSend();" id="doctable">
            <tr>
              <td class="buttonOffLeft" id="btn1_51"></td>
              <td class="buttonOffMiddle" id="btn1_52" onblur="btn_change(5)" onMouseOver="btn_change_over(5)" onMouseOut="btn_change_out(5)" ><img src="${ctx}/images/ico_ok.gif" border="0" align="absmiddle" style="display: "/> 确 定</td>
              <td class="buttonOffRight" id="btn1_53"></td>
            </tr>
          </table>
        </td>
        <td class="btn_between_space"></td>
        <td><table border="0" cellpadding="0" cellspacing="0" onClick="windowClose();">
            <tr>
              <td class="buttonOffLeft" id="btn1_31"></td>
              <td class="buttonOffMiddle" id="btn1_32" onblur="btn_change(3)" onMouseOver="btn_change_over(3)" onMouseOut="btn_change_out(3)"><img src="${ctx}/images/ico_cancel.gif" border="0" align="absmiddle" /> 取 消</td>
              <td class="buttonOffRight" id="btn1_33"></td>
            </tr>
        </table></td>
      </tr>
    </table>
	</td>
</tr>
</table>
<script type="text/javascript">

               Calendar.setup(
              {
	              inputField : "sendDocumengDate", // ID of the input field
	              ifFormat : "%Y-%m-%d", // the date format
	              button : "sendDocumengDateButton", // ID of the button
	              align          :    "Tl",           // alignment (defaults to "Bl")
			      singleClick    :    true
              }
              );
</script>
</body>
</html>